﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using GeneralDFS.BusinessLogical;

namespace GeneralDFS.UnitTest
{
    [TestClass]
    public class BlockUnitTest
    {
        [TestMethod]
        public void TestMethod1()
        {
            FSVolume.Init("C://GDFS-Cloud-DataNode1//Blocks1");
            BlockReader block = new BlockReader(Guid.Parse("1aa56c82-1fff-4eac-8757-3831dfc53a40"));
            byte[] buff = new byte[256];
            int length = block.Read(buff, 0, 256);
            block.close();
            BlockWriter blockWriter = new BlockWriter(Guid.Parse("1aa56c82-1fff-4eac-8757-3831dfc53a40"));
            string s = "**** It is me ****";
            byte[] data = Encoding.Default.GetBytes(s);
            blockWriter.Write(data, 0, data.Length);
            Console.WriteLine(length);
        }

    }
}
